package com.kantboot.tool.edu.repository;

import com.kantboot.tool.edu.domain.vo.ToolEduMajorHasChildren;
import org.jetbrains.annotations.NotNull;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface ToolEduMajorHasChildrenRepository extends JpaRepository<ToolEduMajorHasChildren, Long> {

    /**
     * 根据编码查询
     */
    ToolEduMajorHasChildren findByCode(String code);


    @NotNull
    @Query("""
            FROM ToolEduMajorHasChildren
            WHERE parentCode IS NULL
""")
    List<ToolEduMajorHasChildren> findAll();

}
